<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="fd">防抖</button>
</body>

<script>
    let fd = document.getElementById('fd')
    function replay(fn) {
    let tiemr
    let args = [...arguments].slice(1)
    return function() {
        if(tiemr) {
            clearTimeout(tiemr)
        }
        tiemr = setTimeout(() => {
            console.log(this);
            fn()
        }, 200)
    }
}
function print() {
    console.log(123);
}
    fd.addEventListener('click',replay(print))
</script>
</html>